﻿#include "dxstdafx.h"
#include "GuiCommonConfig.h"

void CGuiCommonConfig::ReadCommonConfig()
{
 	CommonFunc::ReadJsonFile<FontReaderHandle>(L"\\ResFile\\Support\\Font\\Font.ini", &m_mapFontStruct);
 	CommonFunc::ReadJsonFile<Dialog2GuiReaderHandle>(L"\\ResFile\\GUI\\Dialog2Gui.txt", &m_mapDialog2Gui);

	for (const auto &it : m_mapDialog2Gui)
	{
		CommonFunc::ReadJsonFile<GuiPropertyReaderHandle, void>(it.second, NULL);
	}
}

void CGuiCommonConfig::SetDialogFont(CDXUTDialog* pDialog)
{
	CHECK_RETURN(pDialog);
	
	HRESULT hr = S_OK;
	for (auto iter = m_mapFontStruct.begin(); iter != m_mapFontStruct.end(); ++iter)
	{
		V(pDialog->SetFont(iter->first, iter->second.fontName.c_str(), iter->second.fontHeight, iter->second.fontWeight));
	}
}